package com.commpany.servie.basic.order.business.read.userOrder.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.commpany.jdq.core.orm.Pagination;
import com.commpany.servie.basic.order.business.read.userOrder.UserOrderReadManage;
import com.commpany.servie.basic.order.dao.read.UserOrderReadDAO;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jdq.core.common.PageResult;
import com.commpany.servie.basic.order.po.UserOrderPO;
@Slf4j
@Service
public class UserOrderReadManageImpl  implements UserOrderReadManage {
	@Autowired
	private UserOrderReadDAO userOrderReadDAO;
	
	@Override
    public UserOrderPO getUserOrderService(UserOrderPO po){

         return  userOrderReadDAO.findById(po);
    }
    @Override
	public PageResult<UserOrderPO> selectUserOrderPageService(UserOrderPO po, Pagination page){

	    page.setLimitStart((page.getPageNo() - 1) * page.getPageSize());
		PageResult<UserOrderPO> result = new PageResult<UserOrderPO>();
		List<UserOrderPO> list = userOrderReadDAO.findOfPage(po, page);
		int count = userOrderReadDAO.countOfPage(po);
		result.setList(list);
		result.setTotalSize(count);
		result.copy(page);
		return result;
		
	}
	
    @Override
	public int countUserOrderService( UserOrderPO po ){

	    return userOrderReadDAO.countOfPage(po);
	
	}
	
    @Override
	public List<UserOrderPO> queryUserOrderService(UserOrderPO po){

	   return  userOrderReadDAO.findAll(po);
	}
	
}
	